using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using T2.WebSecurity.ASPMVC.Entity;
using T2.WebSecurity.ASPMVC.Entity.Interface;
using T2.WebSecurity.Business.Entities.Interfaces;
using T2.WebSecurity.Business.Entities;
using T2.WebSecurity.ASPMVC.Entity.Translators;

//--Change Management Control - UserProfile ASPMVC Entity Translator  --**********************
//--Created By: James Rooks
//--Description: UserProfile Translator
//--Created Date: 02/05/2013 18:24:12
//--*************************************************************
namespace T2.WebSecurity.ASPMVC.Entity.Translators
{
	public class UserProfileUITranslator 
	{
		public IUserProfile_biz TranslateToBusinessLayer(IUserProfile_ui _translateFrom)
        {
            IUserProfile_biz temp = new UserProfile_biz();
		
			if(_translateFrom != null)
			{
			    temp.Action = _translateFrom.Action;
                temp.Caller = _translateFrom.Caller;
                temp.Role = _translateFrom.Role;
                temp.PageSize = _translateFrom.PageSize;
                temp.PageNumber = _translateFrom.PageNumber;
                temp.SortColumn = _translateFrom.SortColumn;
                temp.SortType = _translateFrom.SortType;
                temp.TotalRows = _translateFrom.TotalRows;
			if (_translateFrom.UserId != null)
			{
				temp.UserId = _translateFrom.UserId;
			}
			else
			{
			temp.UserId = -1;
			}
			if (_translateFrom.UserName != null)
			{
				temp.UserName = _translateFrom.UserName;
			}
			else
			{
			temp.UserName = String.Empty;
			}
			if (_translateFrom.TS != null)
			{
				temp.TS = TranslatorHelper.TranslateTimeStampToBusiness(_translateFrom.TS);
			}
			if (_translateFrom.CreatedBy != null)
			{
				temp.CreatedBy = _translateFrom.CreatedBy;
			}
			else
			{
			temp.CreatedBy = String.Empty;
			}
			if (_translateFrom.CreatedDt != null)
			{
				temp.CreatedDt = _translateFrom.CreatedDt;
			}
			else
			{
			temp.CreatedDt = Convert.ToDateTime(@"01\01\1753");
			}
			if (_translateFrom.ModifiedBy != null)
			{
				temp.ModifiedBy = _translateFrom.ModifiedBy;
			}
			else
			{
			temp.ModifiedBy = String.Empty;
			}
			if (_translateFrom.ModifiedDt != null)
			{
				temp.ModifiedDt = _translateFrom.ModifiedDt;
			}
			else
			{
			temp.ModifiedDt = Convert.ToDateTime(@"01\01\1753");
			}
			if (_translateFrom.IsActive != null)
			{
				temp.IsActive = _translateFrom.IsActive;
			}
			else
			{
			temp.IsActive = false;
			}
			if (_translateFrom.FirstName != null)
			{
				temp.FirstName = _translateFrom.FirstName;
			}
			else
			{
			temp.FirstName = String.Empty;
			}
			if (_translateFrom.LastName != null)
			{
				temp.LastName = _translateFrom.LastName;
			}
			else
			{
			temp.LastName = String.Empty;
			}
			if (_translateFrom.Address != null)
			{
				temp.Address = _translateFrom.Address;
			}
			else
			{
			temp.Address = String.Empty;
			}
			if (_translateFrom.City != null)
			{
				temp.City = _translateFrom.City;
			}
			else
			{
			temp.City = String.Empty;
			}
			if (_translateFrom.Region != null)
			{
				temp.Region = _translateFrom.Region;
			}
			else
			{
			temp.Region = String.Empty;
			}
			if (_translateFrom.PostalCode != null)
			{
				temp.PostalCode = _translateFrom.PostalCode;
			}
			else
			{
			temp.PostalCode = String.Empty;
			}
			if (_translateFrom.OfficePhone != null)
			{
				temp.OfficePhone = _translateFrom.OfficePhone;
			}
			else
			{
			temp.OfficePhone = String.Empty;
			}
			if (_translateFrom.CellPhone != null)
			{
				temp.CellPhone = _translateFrom.CellPhone;
			}
			else
			{
			temp.CellPhone = String.Empty;
			}
			if (_translateFrom.Title != null)
			{
				temp.Title = _translateFrom.Title;
			}
			else
			{
			temp.Title = String.Empty;
			}
			
			
			}
			return temp;
			
		}
		
		public IUserProfile_ui TranslateFromBusinessLayer(IUserProfile_biz _translateFrom)
        {
            IUserProfile_ui temp = new UserProfile_ui();
		
			if(_translateFrom != null)
			{
			    temp.Action = _translateFrom.Action;
                temp.Caller = _translateFrom.Caller;
                temp.Role = _translateFrom.Role;
                temp.PageSize = _translateFrom.PageSize;
                temp.PageNumber = _translateFrom.PageNumber;
                temp.SortColumn = _translateFrom.SortColumn;
                temp.SortType = _translateFrom.SortType;
                temp.TotalRows = _translateFrom.TotalRows;
			if (_translateFrom.UserId != null)
			{
				temp.UserId = _translateFrom.UserId;
			}
			else
			{
			temp.UserId = -1;
			}
			if (_translateFrom.UserName != null)
			{
				temp.UserName = _translateFrom.UserName;
			}
			else
			{
			temp.UserName = String.Empty;
			}
			if (_translateFrom.TS != null)
			{
				temp.TS = TranslatorHelper.TranslateTimeStampFromBusiness(_translateFrom.TS);
			}
			if (_translateFrom.CreatedBy != null)
			{
				temp.CreatedBy = _translateFrom.CreatedBy;
			}
			else
			{
			temp.CreatedBy = String.Empty;
			}
			if (_translateFrom.CreatedDt != null)
			{
				temp.CreatedDt = _translateFrom.CreatedDt;
			}
			else
			{
			temp.CreatedDt = Convert.ToDateTime(@"01\01\1753");
			}
			if (_translateFrom.ModifiedBy != null)
			{
				temp.ModifiedBy = _translateFrom.ModifiedBy;
			}
			else
			{
			temp.ModifiedBy = String.Empty;
			}
			if (_translateFrom.ModifiedDt != null)
			{
				temp.ModifiedDt = _translateFrom.ModifiedDt;
			}
			else
			{
			temp.ModifiedDt = Convert.ToDateTime(@"01\01\1753");
			}
			if (_translateFrom.IsActive != null)
			{
				temp.IsActive = _translateFrom.IsActive;
			}
			else
			{
			temp.IsActive = false;
			}
			if (_translateFrom.FirstName != null)
			{
				temp.FirstName = _translateFrom.FirstName;
			}
			else
			{
			temp.FirstName = String.Empty;
			}
			if (_translateFrom.LastName != null)
			{
				temp.LastName = _translateFrom.LastName;
			}
			else
			{
			temp.LastName = String.Empty;
			}
			if (_translateFrom.Address != null)
			{
				temp.Address = _translateFrom.Address;
			}
			else
			{
			temp.Address = String.Empty;
			}
			if (_translateFrom.City != null)
			{
				temp.City = _translateFrom.City;
			}
			else
			{
			temp.City = String.Empty;
			}
			if (_translateFrom.Region != null)
			{
				temp.Region = _translateFrom.Region;
			}
			else
			{
			temp.Region = String.Empty;
			}
			if (_translateFrom.PostalCode != null)
			{
				temp.PostalCode = _translateFrom.PostalCode;
			}
			else
			{
			temp.PostalCode = String.Empty;
			}
			if (_translateFrom.OfficePhone != null)
			{
				temp.OfficePhone = _translateFrom.OfficePhone;
			}
			else
			{
			temp.OfficePhone = String.Empty;
			}
			if (_translateFrom.CellPhone != null)
			{
				temp.CellPhone = _translateFrom.CellPhone;
			}
			else
			{
			temp.CellPhone = String.Empty;
			}
			if (_translateFrom.Title != null)
			{
				temp.Title = _translateFrom.Title;
			}
			else
			{
			temp.Title = String.Empty;
			}
			
			
			}
			return temp;
			
		}
	
	
	}


}